Page({
  data: {
    from:'',
  },
  onLoad(e){
    console.log(e);
    if (e.from != undefined){
      this.setData({
        from: e.from
      })
    }
    if(e.sku != undefined){
      this.setData({
        sku: e.sku
      })
    }
  },
  bindgetuserinfo(e) {
    console.log(e);
    var status = e.detail.errMsg;
    if (status == 'getUserInfo:fail auth deny') {
      console.log('授权失败')
    } else {
      var toPage;
      if (this.data.from == "index"){
        toPage = '../index/index';
      } else if (this.data.from == 'pDetails'){
        toPage = '../pDetails/pDetails?sku=' +this.data.sku
      }
      wx.redirectTo({
        url: toPage
      })
    }
  },

})